import { Controller, Post, Body } from '@nestjs/common'
import { ApiTags } from '@nestjs/swagger'
import { AuthService } from './auth.service'
import { SignInDTO, SignUpDTO } from './dtos'

@ApiTags('AuthController')
@Controller('/auth')
export class AuthController {
  constructor(private authService: AuthService) {}

  @Post('/signin')
  async signIn(@Body() data: SignInDTO) {
    const token = await this.authService.sign(data)
    return token
  }

  @Post('/signup')
  async signUp(@Body() data: SignUpDTO) {
    await this.authService.createUser(data)
    return null
  }
}
